package com.xunshangwang.pinhaohuo.decorations;

import android.content.Context;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.xunshangwang.pinhaohuo.R;

/**
 * Created by xzp on 16/1/19.
 */
public class GoodsItemDecoration extends RecyclerView.ItemDecoration{
    private int mLeftRightMargin,mTopBottomMargin;
    public GoodsItemDecoration(Context context) {
        mLeftRightMargin=context.getResources().getDimensionPixelSize(R.dimen.goods_item_left_right_margin);
        mTopBottomMargin=context.getResources().getDimensionPixelSize(R.dimen.goods_item_top_bottom_margin);
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        //super.getItemOffsets(outRect, view, parent, state);
        outRect.set(mLeftRightMargin,mTopBottomMargin,mLeftRightMargin,mTopBottomMargin);
    }
}
